package com.atguigu.spring5.testdemo;

import com.atguigu.spring5.Book;
import com.atguigu.spring5.User;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.applet.AppletContext;

public class TestSpring5 {
    @Test
    public void testAdd() {

        //1.加载配置
        ApplicationContext context = new ClassPathXmlApplicationContext("bean1.xml");
        //2. 获取配置的创建对象
        User user = context.getBean("user", User.class);
        System.out.println(user);
        user.add();
    }
    @Test
    public void testBookset() {

        //1.加载配置
        ApplicationContext context = new ClassPathXmlApplicationContext("bean1.xml");
        //2. 获取配置的创建对象
        Book book = context.getBean("user", Book.class);
        System.out.println(book);
        book.testDemon();
    }
}
